import { PureComponent } from "react";

function logRenderTime(OriginComponent) {
  return class extends PureComponent {
    componentWillMount() {
      this.beginTime = new Date().getTime()
    }
    componentDidMount() {
      this.endTime = new Date().getTime()
      const interval = this.endTime - this.beginTime
      console.log('当前',OriginComponent.name,'页面花费了',interval,'ms渲染完成');
    }
    render() {
      return <OriginComponent {...this.props}></OriginComponent>
    }
  }
}

export default logRenderTime